package com.windoent.yugioh.adapter.brvah;

import androidx.annotation.NonNull;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.viewholder.BaseViewHolder;
import com.windoent.yugioh.R;
import com.windoent.yugioh.bean.ZiXunMessageBean;
import com.windoent.yugioh.constants.Constants;
import com.windoent.yugioh.utils.BaseMethod;
import com.windoent.yugioh.utils.SimpleUtils;
import com.windoent.yugioh.widget.RoundImageView;

/**
 * author : robert
 * date   : 2021/5/6 15:26
 * desc   :
 */
public class ZixunListAdapter extends BaseQuickAdapter<ZiXunMessageBean.DataBean.NewsBean, BaseViewHolder> {

    public ZixunListAdapter() {
        super(R.layout.item_list_zixun, null);
    }

    @Override
    protected void convert(@NonNull BaseViewHolder helper, ZiXunMessageBean.DataBean.NewsBean item) {
        helper.setText(R.id.tv_title, BaseMethod.notNullDefaultValueNull(item.getTitle()))
                .setText(R.id.tv_author, BaseMethod.notNullDefaultValueNull(item.getAuthor()))
                .setText(R.id.tv_time, BaseMethod.notNullDefaultValueNull(item.getTime_desc()))
                .setText(R.id.tv_numbers, BaseMethod.notNullDefaultValueNull(item.getView() + ""))
        ;
        RoundImageView imageView = helper.getView(R.id.image);
        if (BaseMethod.notNull(item.getCover()))
            SimpleUtils.loadImageForView(getContext(), imageView, item.getCover(), R.drawable.drawable_no_data);
    }
}